package com.zoe.app;

import com.zoe.jf.JFUser;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.AutoConfigurationPackages;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

import java.util.List;

/**
 * @author zoe.Zhang
 * @date 2022/08/10
 * @description module01和当前类在同一包下
 *         module02和当前类不在一个包下面,所以需要ComponentScan来注册
 */
@SpringBootApplication
@ComponentScan(basePackages = {"com.**.jf", "com.**.app"})
public class BootstrapApp {
    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(BootstrapApp.class, args);
        APPUser bean = run.getBean(APPUser.class);
        System.out.println(bean);
        List<String> strings = AutoConfigurationPackages.get(run);
        for (String string : strings) {
            System.out.println(string);
        }


        JFUser bean1 = run.getBean(JFUser.class);
        System.out.println(bean1);
    }
}
